home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 October
/
EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso
/
Aminet
/
comm
/
mebbs
/
craps30.lha
/
Craps.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1994-08-06
|
13KB
|
454 lines
/***************************************************/
/* $VER: Craps 3.00 */
/* $Filename: Craps.rexx $ */
/* $Version: 3.00 $ */
/* $Creation: 31.1.94 $ */
/***************************************************/
/* Copyright 1994 Mikael Johansson [M6005] */
/*******************************************/
parse arg LineNumber
SIGNAL ON ERROR
options results
DoorName = "Craps"
if( ~show( 'l', "mebbsarexx.library" ) )then do
say "Opening mebbsarexx.library"
if( ~addlib( "mebbsarexx.library", 0, -30, 0 ) )then do
say "Could not open library"
exit 10
end
end
Dir = "Doors:Craps/"
playerfile = dir || "Craps.play"
Maxplayers = 100
if ~EXISTS(dir'Craps.CFG') then do
say "ERROR: Need Craps.CFG in "||dir
say "See Update.ReadMe how to create it"
exit
end
call open file, (dir'Craps.CFG'), 'R'
line = readln(file)
parse var line BBSname=result
line = readln(file)
parse var line Sysopname=result
call close file
call GetVar DoorName,LineNumber,1
handle = result
handle=TRANSLATE(handle,"_"," ")
call GetVar DoorName,LineNumber,8
ansi = result
name=handle
uhandle=handle
udate = date(N)
CLS = 'H'
ROD ='
'
GRON ='
'
GUL ='
'
BLA ='
'
LILA ='
'
CYAN ='
'
VIT ='
'
SVART2 ='
'
BLA2 ='
'
CYAN2 ='
'
normal = '
'
CR='0D'x
d.1.1 = LILA" "CYAN
d.2.1 = LILA" * "CYAN
d.3.1 = LILA" "CYAN
d.1.2 = LILA" *"CYAN
d.2.2 = LILA" "CYAN
d.3.2 = LILA"* "CYAN
d.1.3 = LILA" *"CYAN
d.2.3 = LILA" * "CYAN
d.3.3 = LILA"* "CYAN
d.1.4 = LILA"* *"CYAN
d.2.4 = LILA" "CYAN
d.3.4 = LILA"* *"CYAN
d.1.5 = LILA"* *"CYAN
d.2.5 = LILA" * "CYAN
d.3.5 = LILA"* *"CYAN
d.1.6 = LILA"* *"CYAN
d.2.6 = LILA"* *"CYAN
d.3.6 = LILA"* *"CYAN
CALL BEGIN
CALL INSTRUCTION
START:
string= ""VIT
call output ; call Prompt DoorName,LineNumber," Wich number would you like to bet on (2-12) (Q = Quit) ? "||LILA||"",3
nub = result
CALL CHECKPANIC nub
if nub = "Q" then call BYE
if nub = "q" then call BYE
if nub < 1 | nub > 12 then do
string="B"
call output ; string=LILA||"Invalid number. Try again!"||GUL||"" ; call output
CALL START
end
string=""VIT ; call output
call Prompt DoorName,LineNumber," and how much would you like to bet? "||LILA||"",4
bet = result
CALL CHECKPANIC bet
if Bet > AcctBal then do
string="B" ; call output
string=VIT"You can not bet more than your account balance of: $"AcctBal". Try Again!" ; call output
CALL START
end
else if Bet > 1000 then do
string=VIT"You can not bet more $1,000. Try Again!" ; call output
CALL START
end
CALL ROLL(6)
total = die1 + die2
string=VIT"Total rolled is:"||LILA||total||VIT ; call output
string="" ; call output
if total = nub & total = 7 then
do
abet = bet * 10
acctbal = acctbal + abet
string=" You "||ROD||"WIN"||VIT||" ! "||GRON||abet||VIT ; call output
end
if total = nub & total = 2 then
do
abet = bet + bet
acctbal = acctbal + abet
string=" You "||ROD||"WIN"||VIT||" ! "||GRON||abet||VIT ; call output
end
if total = nub & total = 3 then
do
abet = bet + bet
acctbal = acctbal + abet
string=" You "||ROD||"WIN"||VIT||" ! "||GRON||abet||VIT ; call output
end
if total = nub & total = 4 then
do
abet = bet + bet
acctbal = acctbal + abet
string=" You "||ROD||"WIN"||VIT||" ! "||GRON||abet||VIT ; call output
end
if total = nub & total = 5 then
do
abet = bet + bet
acctbal = acctbal + abet
string=" You "||ROD||"WIN"||VIT||" ! "||GRON||abet||VIT ; call output
end
if total = nub & total = 6 then
do
abet = bet + bet + bet
acctbal = acctbal + abet
string=" You "||ROD||"WIN"||VIT||" ! "||GRON||abet||VIT ; call output
end
if total = nub & total = 8 then
do
abet = bet + bet + bet
acctbal = acctbal + abet
string=" You "||ROD||"WIN"||VIT||" ! "||GRON||abet||VIT ; call output
end
if total = nub & total = 9 then
do
abet = bet + bet
acctbal = acctbal + abet
string=" You "||ROD||"WIN"||VIT||" ! "||GRON||abet||VIT ; call output
end
if total = nub & total = 10 then
do
abet = bet + bet
acctbal = acctbal + abet
string=" You "||ROD||"WIN"||VIT||" ! "||GRON||abet||VIT ; call output
end
if total = nub & total = 11 then
do
abet = bet + bet
acctbal = acctbal + abet
string=" You "||ROD||"WIN"||VIT||" ! "||GRON||abet||VIT ; call output
end
if total = nub & total = 12 then
do
abet = bet * 5
acctbal = acctbal + abet
string=" You "||ROD||"WIN"||VIT||" ! "||GRON||abet||VIT ; call output
end
if total ~= nub then
do
string="" ; call output
string=" You "||ROD||"LOOSE"||VIT||" !!!" ; call output
acctbal = acctbal - bet
end
string="" ; call output
string="You have now $"||GRON||acctbal||VIT ; call output
if acctbal <= 0 then CALL BYE1
string="" ; call output
call Prompt DoorName,LineNumber,"Roll Again (y/N) ?",2
ans=upper(result)
if ans = "Y" then call START
if ans = "" then call BYE
if ans = " " then call BYE
if ans = "N" then call BYE
Call Bye
BEGIN:
string=CLS
call output ; string=VIT
call output ; string=" Welcome to another fine "||GRON||"Active"||VIT||" product."
call output ; string=" "
call output ; string=" Here we present "||CYAN||"CRAPS v3.0"||VIT||" to you"
call output ; string=" "
call output ; string=" Created by : Mikael Johansson [M6005]"
call output ; string=""
call output
/* CALL PAUSE */
CALL PLAYERFILE
CALL SCOREBOARD
RETURN
INSTRUCTION:
string=CLS
call output ; string=VIT
call output ; string=" Win Table"
call output ; string=" --- -----"
call output ; string=" "
call output ; string=LILA" 2 "||GRON||"Gives you"||CYAN||" 2 "||GUL||"*"||GRON||" Bet "
call output ; string=LILA" 3 "||GRON||"Gives you"||CYAN||" 2 "||GUL||"*"||GRON||" Bet "
call output ; string=LILA" 4 "||GRON||"Gives you"||CYAN||" 2 "||GUL||"*"||GRON||" Bet "
call output ; string=LILA" 5 "||GRON||"Gives you"||CYAN||" 2 "||GUL||"*"||GRON||" Bet "
call output ; string=LILA" 6 "||GRON||"Gives you"||CYAN||" 3 "||GUL||"*"||GRON||" Bet "
call output ; string=LILA" 7 "||GRON||"Gives you"||CYAN||" 10 "||GUL||"*"||GRON||" Bet "
call output ; string=LILA" 8 "||GRON||"Gives you"||CYAN||" 3 "||GUL||"*"||GRON||" Bet "
call output ; string=LILA" 9 "||GRON||"Gives you"||CYAN||" 2 "||GUL||"*"||GRON||" Bet "
call output ; string=LILA" 10 "||GRON||"Gives you"||CYAN||" 2 "||GUL||"*"||GRON||" Bet "
call output ; string=LILA" 11 "||GRON||"Gives you"||CYAN||" 2 "||GUL||"*"||GRON||" Bet "
call output ; string=LILA" 12 "||GRON||"Gives you"||CYAN||" 5 "||GUL||"*"||GRON||" Bet "
call output ; string=" "
call output
RETURN
ROLL:
ARG n
x=OPEN(f,'RAM:DUMMY','W')
IF x=0 THEN CALL QEXIT
CALL WRITELN(f,'dummy')
CALL CLOSE(f)
die1=(WORD(STATEF('RAM:DUMMY'),7)%1)//n+1
CALL DELAY(28+LEFT(die1,2))
x=OPEN(f,'RAM:DUMMY','W')
IF x=0 THEN CALL QEXIT
CALL WRITELN(f,'dummy')
CALL CLOSE(f)
die2=(WORD(STATEF('RAM:DUMMY'),7)%1)//n+1
string=CR
call output ; string=CYAN" ------- -------"CR
call output ; string=CYAN" | "d.1.die1" | | "d.1.die2" |"CR
call output ; string=CYAN" | "d.2.die1" | | "d.2.die2" |"CR
call output ; string=CYAN" | "d.3.die1" | | "d.3.die2" |"CR
call output ; string=CYAN" ------- -------"CR
call output ; string=VIT||CR
call output
RETURN
PLAYERFILE:
string="" ; call output
string=GUL" Checking player file..." ; call output
string="" ; call output
Acctbal = 100
Flag = 0
nplayers = 0
if ~exists(playerfile) then signal newfile
call open(file1,playerfile, 'R')
nplayers = readln(file1)
if nplayers = 0 then signal newfile
do i = 1 to nplayers
player.i = readln(file1)
score.i = readln(file1)
if player.i = Uhandle then do
Acctbal = score.i
if acctbal <= 0 then acctbal = 100
string=VIT"I see you have bet here before!" ; call output
string=VIT"Your account balance is: $"CYAN||Acctbal||VIT ; call output
string=" "; call output
Flag = 1
end
end
call close(file1)
Newfile:
if Flag = 0 then do
if nplayers < MaxPlayers then do
string=VIT"Ah Ha,, another New Player!!" ; call output
string=VIT"You will be given $100 to start you out!" ; call output
nplayers = nplayers + 1
player.nplayers = UHandle
score.nplayers = Acctbal
end
else if nplayers >= MaxPlayers then do
string="" ; call output
string="Sorry there is no room for another Craps gambler !!!!!" ; call output
string="Talk to Sysop maybe he/she can do something about that!" ; call output
call HotKey DoorName,LineNumber,"Press any key ..."
CALL BYE
end
end
RETURN
SCOREBOARD:
string="" ; call output
string=" Sorting Scores............." ; call output
CALL SORTSCORES
Flag = 1
i = 1
j = 1
More = 'Y'
Do Forever
if More ~= 'Y' then break
Do while Flag = 1
string="" ; call output
string=GUL" *******************************" ; call output
string=LILA" SCOREBOARD" ; call output
string=GUL" *******************************"||LILA||"" ; call output
Flag = 0
end
if player.j = UHandle then Score.j = AcctBal
P = Left(Player.j,20,' ')
string=" "P" $"Score.j ; call output
i = i + 1
j = j + 1
if j > Nplayers then break
else if j <= Nplayers & i = 11 then do
Flag = 1
i = 0 /* Only display 10 names per page */
string=GUL" *******************************" ; call output
call Prompt DoorName,LineNumber,GUL" Do you want to see more (Y/N)? ",2
More=result ; more = upper(more) ; more = left(more,1)
CHECKPANIC more
iterate
end
else if j <= Nplayers & i < 11 then iterate
end
if More = 'Y' then string=GUL" *******************************" ; call output
CALL PAUSE
RETURN
SORTSCORES:
if nplayers < 2 then return
do i = 1 to (Nplayers - 1)
do j = (i+1) to Nplayers
if Score.i < Score.j then do
Temp = Score.i
Score.i = Score.j
Score.j = Temp
Temp = Player.i
Player.i = Player.j
Player.j = Temp
end
end
end
RETURN
BYE:
string=CLS
call output ; string=VIT
call output ; string=" Thankx for playing "||CYAN||"CRAPS"||VIT||" from "||LILA||"Active Development"||vit
call output ; string=" "
call output ; string=" This Game is created by : Mikael Johansson [M6005]"
call output ; string=" "
call output ; string=" Support and developer board for this game is AnkeBorg"
call output ; string=" FidoNet 2:200/210.0"
call output ; string=" "
call output ; string=CYAN" AnkeBorg INT +46-42-293375"VIT
call output ; string=" "
call output
CALL SORTSCORES
string = "delete >nil: doors:craps/craps.play"
address command string
call open(file1,playerfile,'W')
call writeln(file1,NPlayers)
do i = 1 to NPlayers
if player.i = UHandle then Score.i = Acctbal
call writeln(file1, player.i)
call writeln(file1, score.i)
end
call close(file1)
call HotKey DoorName,LineNumber,"Press Any key to getback to "||bbsname
call Exit_Door DoorName,LineNumber
exit 0
BYE1:
string="" ; call output
string=" YOU HAVE LOST EVERYTHING YOU HAVE" ; call output
string=" PLEASE START THIS GAME AGAIN AND" ; call output
string=" YOU WILL GET ANOTHER 100$" ; call output
string="" ; call output
CALL SORTSCORES
string = "delete >nil: doors:Craps/Craps.play"
address command string
call open(file1,playerfile,'W')
call writeln(file1,NPlayers)
do i = 1 to NPlayers
if player.i = UHandle then Score.i = Acctbal
call writeln(file1, player.i)
call writeln(file1, score.i)
end
call close(file1)
call HotKey DoorName,LineNumber,"Press Any key to getback to "||bbsname
call Exit_Door DoorName,LineNumber
exit 0
PAUSE:
string=" " ; call output
call HotKey DoorName,LineNumber,"Press Any key...."
string=" " ; call output
RETURN
CHECKPANIC: procedure
RETURN
END_IT:
string="Pick a number next time" ; call output
call HotKey DoorName,LineNumber,"Press Any key...."
call Exit_Door DoorName,LineNumber
exit 0
QEXIT:
string=" 0 picked number" ; call output
string="Returning to bbs" ; call output
call ERROR
/************************************************************************/
/* Routines */
/************************************************************************/
ERROR:
call Exit_Door DoorName,LineNumber
exit 10
output:
call message DoorName,LineNumber,string,1
return